home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Technical Documentation / Sample Code / DTS.Lib & Samples / DTS.Draw / EventLoop.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-22  |  2.0 KB  |  79 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        EventLoop.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1990-1992 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11.  
  12.  
  13. /*****************************************************************************/
  14.  
  15.  
  16.  
  17. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  18. #include "App.Common.h"        /* Get the stuff in common with rez.            */
  19. #include "App.protos.h"        /* Get the prototypes for the application.        */
  20.  
  21.  
  22.  
  23. /*****************************************************************************/
  24.  
  25.  
  26.  
  27. extern RgnHandle    gCursorRgn;                /* DTS.Lib..framework global. */
  28.     /* The current cursor region.  The initial cursor region is an empty region,
  29.     ** which will cause WaitNextEvent to generate a mouse-moved event, which will
  30.     ** cause us to set the cursor for the first time. */
  31.  
  32. extern Boolean        gQuitApplication;        /* DTS.Lib..framework global. */
  33.     /* This is set to false by Initialize.  When the user selects Quit
  34.     ** (and does not abort the quit), then this boolean is set true. */
  35.  
  36.  
  37.  
  38. /*****************************************************************************/
  39. /*****************************************************************************/
  40.  
  41.  
  42.  
  43. /* Get events forever, and handle them by calling DoEvent.  Get the events by
  44. ** calling WaitNextEvent. */
  45.  
  46. #pragma segment Main
  47. void    EventLoop(void)
  48. {
  49.     EventRecord        event;
  50.  
  51.     while (!gQuitApplication) {
  52.         if (!WaitNextEvent(everyEvent, &event, 15, gCursorRgn))
  53.             event.what = nullEvent;
  54.         DoEvent(&event);
  55.     };
  56. }
  57.  
  58.  
  59.  
  60. /*****************************************************************************/
  61.  
  62.  
  63.  
  64. /* •• Called by DTS.Lib..framework. •• */
  65.  
  66. /* Handle the cursor changes.  Most of the work is done by the application
  67. ** framework.  Each window has its own cursor calculation proc, so you
  68. ** shouldn't have to add any code here.  You may wish to do some special
  69. ** stuff prior to the DoWindowCursor call if you have modeless dialogs. */
  70.  
  71. #pragma segment Main
  72. void    DoCursor(void)
  73. {
  74.     DoWindowCursor();
  75. }
  76.  
  77.  
  78.  
  79.